package com.boss.salary.utils;

import com.boss.salary.dao.ISalaryMonthEndDao;
import com.boss.salary.service.IFormulaManageService;
import com.boss.salary.vo.SalaryMonthEndVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;
public class ThreadSalaryBaseDataUpdate  implements Runnable {
    /**
     * 引入日志框架常量
     */
    private final static Logger logger = LoggerFactory.getLogger(ThreadSalaryBaseDataUpdate.class);

    private IFormulaManageService formulaManageService;
    private ISalaryMonthEndDao salaryMonthEndDao;
    private List<SalaryMonthEndVO> salaryMonthEndVOList;
    private String province;
    private List<String> agencyIds;

    @Override
    public void run() {
        try {
            salaryMonthEndVOList = formulaManageService.calculateByFormula(province, agencyIds, salaryMonthEndVOList);
            salaryMonthEndDao.batchUpdateSalaryMonthEnd(salaryMonthEndVOList);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void setSalaryMonthEndVOList(List<SalaryMonthEndVO> salaryMonthEndVOList) {
        this.salaryMonthEndVOList = salaryMonthEndVOList;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public void setAgencyIds(List<String> agencyIds) {
        this.agencyIds = agencyIds;
    }

    public void setFormulaManageService(IFormulaManageService formulaManageService) {
        this.formulaManageService = formulaManageService;
    }

    public void setSalaryMonthEndDao(ISalaryMonthEndDao salaryMonthEndDao) {
        this.salaryMonthEndDao = salaryMonthEndDao;
    }
}
